<template>
  <div class="page_box">
    <!-- 搜索区域 开始 -->
    <el-card shadow="never">
      <el-form :inline="true" size="small" :model="formInline" class="demo-form-inline">
        <el-form-item label="名称：">
          <el-input
            v-model="formInline.term"
            placeholder="用户名/账号/手机号"
          ></el-input>
        </el-form-item>
        <el-form-item label="注册时间：">
          <el-date-picker v-model="createTime" type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" value-format="yyyy-MM-dd">
          </el-date-picker>
        </el-form-item>
        <!-- <el-form-item label="系统：">
          <el-select v-model="formInline.region" placeholder="活动区域">
            <el-option label="苹果" value="shanghai"></el-option>
            <el-option label="安卓" value="beijing"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="版本：">
          <el-select v-model="formInline.region" placeholder="活动区域">
            <el-option label="区域一" value="shanghai"></el-option>
            <el-option label="区域二" value="beijing"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="渠道：">
          <el-select v-model="formInline.region" placeholder="活动区域">
            <el-option label="区域一" value="shanghai"></el-option>
            <el-option label="区域二" value="beijing"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="地区：">
          <el-select v-model="formInline.region" placeholder="活动区域">
            <el-option label="区域一" value="shanghai"></el-option>
            <el-option label="区域二" value="beijing"></el-option>
          </el-select>
        </el-form-item> -->
        <el-form-item>
          <el-button type="primary" @click="getList">查询</el-button>
        </el-form-item>
      </el-form>
    </el-card>
    <!-- 搜索区域 end -->

    <div class="link_group">
      <el-button size="small" type="success" plain>导出excel</el-button>
    </div>

    <!-- 表格 开始 -->
    <div class="table_box">
      <el-table class="tab" size="small" :data="tableData" border stripe>
        <el-table-column type="index" label="序号" width="60" />
        <el-table-column prop="unionId" label="ID" show-overflow-tooltip />
        <el-table-column prop="username" label="用户昵称" show-overflow-tooltip />
        <el-table-column prop="banTime" label="封禁日期" show-overflow-tooltip />
        <el-table-column prop="liftBanTime" label="解禁日期" show-overflow-tooltip />
        <el-table-column prop="gender" label="性别" show-overflow-tooltip>
          <template slot-scope="scope">{{
            scope.row.gender == 0 ? "男" : "女"
          }}</template>
        </el-table-column>
        <el-table-column prop="city" label="地区" show-overflow-tooltip />
        <el-table-column prop="vipStatus" label="会员" show-overflow-tooltip>
          <template slot-scope="scope">{{
            scope.row.vipStatus == 1 ? "是" : "否"
          }}</template>
        </el-table-column>
        <el-table-column prop="banReason" label="封禁原因" show-overflow-tooltip />
        <el-table-column prop="liftBanUsername" label="解禁操作人" show-overflow-tooltip />
        <el-table-column prop="banDays" label="封禁时间" show-overflow-tooltip />
        <el-table-column prop="banCnt" label="封禁次数" show-overflow-tooltip />
        <el-table-column prop="address" label="操作" width="100px">
          <template slot-scope="scope">
            <el-link type="primary" @click="lookDetail(scope.row)">查看</el-link>
          </template>
        </el-table-column>
      </el-table>
      <div class="pagination_list">
        <el-pagination background layout="sizes, total,prev, pager, next, jumper" hide-on-single-page :total="pageTotal" :page-size="pageSize" :page-sizes="pageSizes" :current-page.sync="pageNumber" @current-change="getList" @size-change="changePageSize" />
      </div>
    </div>
    <!-- 表格 end -->

    <!-- 弹框 开始 -->
    <glsx-dialog :show="showDialog" title="解封详情" width="50%" @close="closeDialog">
      <div class="">
        <!-- 单行 开始 -->
        <div class="row_box">
          <div class="cell">
            <span class="name">封禁审核人：</span>
            <div class="txt">{{ userInfo.username }}</div>
          </div>
          <div class="cell">
            <span class="name">解封操作人：</span>
            <div class="txt">{{ userInfo.banUsername }}</div>
          </div>
        </div>
        <!-- 单行 结束 -->
        <!-- 单行 开始 -->
        <div class="row_box">
          <div class="cell">
            <span class="name">封禁时间：</span>
            <div class="txt">{{ userInfo.unionId }}</div>
          </div>
          <div class="cell">
            <span class="name">解封时间：</span>
            <div class="txt">{{ userInfo.banTime }}</div>
          </div>
        </div>
        <!-- 单行 结束 -->
        <!-- 单行 开始 -->
        <div class="row_box">
          <div class="cell">
            <span class="name">备注：</span>
            <div class="txt">{{ userInfo.unionId }}</div>
          </div>
        </div>
        <!-- 单行 结束 -->
      </div>
      <div slot="footer">
        <el-button type="success" plain size="small" @click="closeDialog">关闭</el-button>
      </div>
    </glsx-dialog>
    <!-- 弹框 end -->

  </div>
</template>

<script>
import { GETBLACKLISTSEARCH, GETVIPINFO, LIFTBANUSER } from "@/http/interface";
import { showModal, showToast } from "@/common/util";
import GlsxDialog from "@/components/Dialog";
export default {
  components: {
    GlsxDialog,
  },
  data() {
    return {
      formInline: {},
      createTime: [],
      tableData: [],
      pageSize: 10,
      pageTotal: 0,
      pageNumber: 1,
      pageSizes: [10, 20, 30, 40],
      showDialog: false,
      vipHistory: [],
      userInfo:{}
    };
  },
  mounted() {
    this.getList();
  },
  methods: {
    /** 获取参数 */
    getParams() {
      let _this = this;
      let o = JSON.parse(JSON.stringify(_this.formInline)) || {};
      let n = _this.createTime;
      console.log(n);
      if (n && n.length > 0) {
        o.sDate = n[0];
        o.eDate = n[1];
      } else {
        delete o.sDate;
        delete o.eDate;
      }
      o.pageNumber = this.pageNumber;
      o.pageSize = this.pageSize;
      return o;
    },

    /** 每页展示 */
    changePageSize(e) {
      this.pageSize = e;
      this.getList();
    },

    /** 获取列表 */
    getList() {
      let _this = this;
      let oParams = this.getParams();
      GETBLACKLISTSEARCH(oParams).then((res) => {
        console.log(res);
        let obj = res.data || {};
        _this.tableData = obj.list || [{}];
        //_this.tableData = [{}];
        _this.pageTotal = obj.totalElements;
      });
    },

    /** 查看详情 */
    lookDetail(row) {
      this.showDialog = true;
      let oParams = {};
      let _this = this;
      oParams.userId = row.userId;
      _this.userInfo = row;
      // GETVIPINFO(oParams).then((res) => {
      //   let obj = res.data || {};
      //   _this.vipHistory = obj.vipHistory || [];
      // });
    },

    /** 关闭弹框 */
    closeDialog() {
      this.showDialog = false;
      this.certification = {};
      this.photoList = [];
      this.profile = {};
      this.vipInfo = {};
    },
    
  },
};
</script>

<style lang="scss" scoped>
.link_group {
  margin-top: 10px;
  text-align: right;
}
.total_box {
  margin: 10px 0 0 0;
  // background:#f0f9eb;
  padding: 10px;
  font-size: 14px;
  span {
    position: relative;
    margin: 0 30px 0 0;
    padding-left: 12px;
    color: #666;
    i {
      font-size: 24px;
      font-style: normal;
      margin: 0 5px;
    }
  }
  span:after {
    display: block;
    content: "";
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 100%;
    background: #f00;
    top: 50%;
    left: 0px;
    margin-top: -4px;
  }
  .sp1:after {
    background: #49a9ee;
  }
  .sp2:after {
    background: #7dc856;
  }
  .sp3:after {
    background: #ffd86e;
  }
  .sp4:after {
    background: #cc33ff;
  }
  .sp5:after {
    background: #ff9933;
  }
}
.tab_line {
  width: 100%;
  border: 1px solid #d8d8d8;
  border-collapse: collapse;
  thead {
    th {
      border: 1px solid #d8d8d8;
      padding: 8px;
      text-align: left;
    }
  }
  td {
    border: 1px solid #d8d8d8;
    padding: 8px;
  }
}
.tips_box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 0;
}
.row_box {
  // width: 50%;
  display: flex;
  margin: 10px 0;
  .cell {
    flex: 1;
    display: flex;
    color: #333;
    .name {
      width: 120px;
      text-align: right;
      font-size: 14px;
      color: #999;
    }
    .txt {
      font-size: 14px;
      flex: 1;
    }
  }
}
</style>
